import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeContainer from './components/tabbar/HomeContainer.vue'
import MemberContainer from './components/tabbar/MemberContainer.vue'
import CartContainer from './components/tabbar/CartContainer.vue'
import SearchContainer from './components/tabbar/SearchContainer.vue'
import newslist from '../src/components/news/newslist.vue'
import newsinfo from '../src/components/news/newsinfo.vue'
import photos from '../src/components/photos/photos.vue'
import photosinfo from '../src/components/photos/photosinfo.vue'
import goodslist from '../src/components/goods/goodslist.vue'
import goodsinfo from '../src/components/goods/goodsinfo.vue'

Vue.use(VueRouter)

var router = new VueRouter({
    routes: [
        { path: '/', redirect: '/home' },
        { path: '/home', component: HomeContainer },
        { path: '/member', component: MemberContainer },
        { path: '/cart', component: CartContainer },
        { path: '/search', component: SearchContainer },
        { path: '/home/newslist', component: newslist },
        { path: '/home/newsinfo/:id', component: newsinfo }, //根据不同id放不同新闻页面，因此需要在后面加：绑定id
        { path: '/home/photos', component: photos },
        { path: '/home/photos/:uid/:id', component: photosinfo },
        { path: '/home/goodslist', component: goodslist },
        { path: '/home/goodslist/:id', component: goodsinfo, name: 'goodsinfo' }
    ],
    linkActiveClass: 'mui-active' //覆盖默认高亮的类名,默认的类名叫 router-link-active
})

export default router